//
// Created by tianq on 24-11-27.
//
#include <algorithm>
#include <iostream>
#include <vector>
#include <random>
#include "BFPRT.hpp"
using namespace std;

int main() {
    cout.precision(4);
    random_device rd;
    mt19937_64 rng(rd());
    uniform_real_distribution<> uniform_dist(1, 100);

    vector<double> arr;
    for (int i = 0; i < 10; i++) {
        arr.push_back(uniform_dist(rng));
        cout << arr[i] << ", ";
    }
    cout << endl;

    // cout << PickRandom(arr) << endl;
    // cout << PickFirst(arr) << endl;
    // cout << PickBfprt(arr) << endl;
    // cout << BruteMedian(arr) << endl;
    cout << "BFPRT:\t" << QuickSelect(arr, 5, PickBfprt) << endl;
    cout << "First:\t" << QuickSelect(arr, 5, PickFirst) << endl;
    cout << "Random:\t" << QuickSelect(arr, 5, PickRandom) << endl;
    cout << "Brute:\t" << BruteNth(arr, 5) << endl;

    ranges::sort(arr);
    for (const auto &num: arr) cout << num << ", ";
}
